﻿using PBO.Data.Domain;
using PBO.Data.Util;
using System;
using System.Data;
using System.Linq;

namespace PBO.Data.SQLite.DAL
{
    public class DALAbility : DALModel<Ability>
    {

        #region Instance

        private DALAbility() { }

        private static DALAbility instance;

        public static DALAbility GetInstance()
        {
            if (instance == null)
                instance = new DALAbility();
            return instance;
        }

        #endregion

        #region override

        protected override string GetTableName()
        {
            return "pbo_ability";
        }

        protected override Ability DataRowToModel(DataRow dr)
        {
            var ab = new Ability();
            ab.Id = dr["id"].ToString().ToInt();
            ab.Name = dr["name"].ToString();
            return ab;
        }

        public Ability GetModel(int id)
        {
            return base.GetModel("id=" + id).FirstOrDefault();
        }

        #endregion

    }
}
